#include "../include/unm.h"
#include <iostream>
#include <vector>

int main() {
    std::cout << "=== Universal Node Manager 演示 ===" << std::endl;
    
    unm::GitNodeManager manager;
    
    // 添加Git仓库
    std::cout << "\n1. 添加Git仓库..." << std::endl;
    manager.addGitRepository("/d/vc/wxWidgets");
    
    // 寻找镜像
    std::cout << "\n2. 寻找镜像仓库..." << std::endl;
    auto mirrors = manager.findMirrorRepositories("https://github.com/libexpat/libexpat");
    
    std::cout << "找到的镜像:" << std::endl;
    for (const auto& mirror : mirrors) {
        std::cout << "  - " << mirror << std::endl;
    }
    
    // 计算令牌权重
    std::cout << "\n3. 计算节点权重..." << std::endl;
    manager.calculateTokenWeights();
    
    // 寻找相似节点
    std::cout << "\n4. 寻找相似节点..." << std::endl;
    auto similar = manager.findSimilarNodes("git:/d/vc/wxWidgets");
    
    std::cout << "相似节点:" << std::endl;
    for (const auto& node_id : similar) {
        std::cout << "  - " << node_id << std::endl;
    }
    
    // 保存状态
    std::cout << "\n5. 保存状态到文件..." << std::endl;
    if (manager.saveToFile("node_graph.dat")) {
        std::cout << "状态已保存到 node_graph.dat" << std::endl;
    } else {
        std::cout << "保存状态失败" << std::endl;
    }
    
    std::cout << "\n=== 演示完成 ===" << std::endl;
    return 0;
}
